package com.beemans.common.state

import com.tiamosu.fly.base.dialog.loading.LoadingConfig

/**
 * @author tiamosu
 * @date 2021/3/12
 */
sealed class ResultState {
    data class Toast(val msg: String?) : ResultState()
    data class LoadingShow(val config: LoadingConfig?) : ResultState()
    data class LoadingHide(val msg: String? = null) : ResultState()
    data class ViewLoading(val msg: String? = null) : ResultState()
    data class ViewSuccess(val msg: String? = null) : ResultState()
    data class ViewEmpty(val msg: String? = null) : ResultState()
    data class ViewError(val msg: String? = null) : ResultState()

    companion object {
        fun showToast(msg: String?) = Toast(msg)
        fun showLoading(config: LoadingConfig?) = LoadingShow(config)
        fun hideLoading() = LoadingHide()
        fun showViewLoading() = ViewLoading()
        fun showViewSuccess() = ViewSuccess()
        fun showViewEmpty() = ViewEmpty()
        fun showViewError() = ViewError()
    }
}